<script setup>
const baseUrl = import.meta.env.VITE_PROXY + 'api/common/file'
const emit = defineEmits(['uploadSuccess'])
const change = (e) => {
  const { status, response } = e.file
  if (status === 'done') {
    if (response.code === 0) emit('uploadSuccess', response.data)
  }
}
</script>
<template>
  <a-upload name="file" :action="baseUrl" :showUploadList="false" accept="image/*" @change="change">
    <slot></slot>
  </a-upload>
</template>
